package com.xx.greed.server.core;

import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;

import com.xx.greed.common.utils.Managed;
import com.xx.greed.common.utils.NamedThreadFactory;
import com.xx.greed.server.GreedConfig;


public class ExecutorsManager implements Managed {

    private final ThreadPoolExecutor getExecutor;
    private final GreedConfig greedConfig;


    public ExecutorsManager(final GreedConfig greedConfig) {
        super();
        this.greedConfig = greedConfig;
        this.getExecutor =
                (ThreadPoolExecutor) Executors.newFixedThreadPool(40 * Runtime.getRuntime().availableProcessors(),
                    new NamedThreadFactory("GetProcess"));

    }


    public ThreadPoolExecutor getGetExecutor() {
        return this.getExecutor;
    }


    @Override
    public void dispose() {
        if (this.getExecutor != null) {
            this.getExecutor.shutdown();
        }
    }


    @Override
    public void init() {
    }

}
